use crate::symbols::symbols::SymbolicExp::{Number, Symbol};
use crate::symbols::traits::Derivate;
use crate::vector::vector::Vector;
#[test]
fn identity_vector() {
    let vector1 = Vector::new(vec![Number(1.0), 1.0.into(), 1.0.into(), 1.0.into()]);
    println!("{:?}", vector1);
    let vector2 = vector1.get_identity();
    println!("{:?}", vector2);
}

#[test]
fn add_vector() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let vector1 = Vector::new(vec![Number(0.0), x, 5.0.into(), 0.0.into()]);
    let vector2 = Vector::new(vec![Number(0.0), y, 3.0.into(), 0.0.into()]);
    let vector3 = vector1 + vector2;
    println!("{:?}", vector3);
}

#[test]
fn mul_vector() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());

    let vector1 = Vector::new(vec![Number(0.0), x, y, 0.0.into()]);
    let vector3 = vector1.clone() * Number(3.0);
    println!("{:?}", vector3);
}

#[test]
fn div_vector() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let vector1 = Vector::new(vec![Number(0.0), x, y, 0.0.into()]);
    let vector2 = vector1.clone() / Number(3.0);
    println!("{:?}", vector2);
}

#[test]
fn dot_vector() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let vector1 = Vector::new(vec![Number(0.0), x, 5.0.into(), 0.0.into()]);
    let vector2 = Vector::new(vec![Number(0.0), y, 3.0.into(), 0.0.into()]);
    let dot_result = vector1.dot(vector2);
    println!("{:?}", dot_result);
}

#[test]
fn cross_vector() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let vector1 = Vector::new(vec![Number(1.0), x.clone(), 4.0.into()]);
    let vector2 = Vector::new(vec![Number(2.0), y.clone(), 5.0.into()]);

    let cross_result1 = vector1.cross(vector2);
    println!("{:?}", cross_result1);

    let vector3 = Vector::new(vec![x, 4.0.into()]);
    let vector4 = Vector::new(vec![y, 6.0.into()]);

    let cross_result2 = vector3.cross(vector4);
    println!("{:?}", cross_result2);
}

#[test]
fn vector_derivate_from_symbols() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let symbols = x.clone() * y.clone();
    let vector1 = Vector::new(vec![x.clone() * y.clone(), x.clone(), y.clone()]);

    println!("{:?}", vector1.derivate_from_symbols(symbols));
}

#[test]
fn vector_derivate_by_vector() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let vector1 = Vector::new(vec![x.clone() * y.clone(), x.clone(), y.clone()]);
    let vector2 = Vector::new(vec![
        x.clone() * y.clone(),
        x.clone() + Number(2.0),
        y.clone(),
    ]);

    println!("{:?}", vector1.derivate_by_vector(vector2));
}
